package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.AddShareCountRequest;
import one.stand.request.CreateShareRecordRequest;
import one.stand.request.statistics.share.ShareTopNRequest;
import one.stand.request.statistics.share.ShareTypeDetailsStatisticsRequest;
import one.stand.request.statistics.share.SituationShareStatisticsRequest;
import one.stand.response.statistics.share.ShareTypeDetailsStatisticsRepository;
import one.stand.response.statistics.share.ShareUserTopNResponse;
import one.stand.response.statistics.share.SituationShareStatisticsResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 分享记录
 * Created by renz on 2019/10/24 00:10
 */
@RestController
@RequestMapping("/shareRecord")
public class ShareRecordController extends BaseController {

    /**
     * 添加分享记录
     */
    @PostMapping("addShareRecord")
    public ResultModel<Integer> addShareRecord(@RequestBody CreateShareRecordRequest request) {
        return shareRecordService.addShareRecord(request);
    }

    /**
     * 添加打开分享次数
     */
    @PostMapping("addOpenShareCount")
    public ResultModel<Boolean> addOpenShareCount(@RequestBody AddShareCountRequest request) {
        return shareRecordService.addOpenShareCount(request);
    }

    /**
     * 行为分析统计
     */
    @PostMapping("situationStatistics")
    public ResultModel<SituationShareStatisticsResponse> situationStatistics(@RequestBody SituationShareStatisticsRequest request) {
        return shareRecordService.situationStatistics(request);
    }

    /**
     * topN
     */
    @PostMapping("topN")
    public ResultModel<List<ShareUserTopNResponse>> topN(@RequestBody ShareTopNRequest request) {
        return shareRecordService.topN(request);
    }

    /**
     * 分享类别明细统计
     */
    @PostMapping("shareTypeDetailsStatistics")
    public ResultModel<List<ShareTypeDetailsStatisticsRepository>> shareTypeDetailsStatistics(@RequestBody ShareTypeDetailsStatisticsRequest request) {
        return shareRecordService.shareTypeDetailsStatistics(request);
    }

}
